package 面试.遍历算法.String类型题目;

public class 统计次数 {
    public static void main(String[] args) {
        String str = "abcdab";
        for (int i = 0; i < str.length(); ) {
            char c = str.charAt(i);
            String str1 = str.replaceAll(c+"","");
            int num = str.length() - str1.length();
            System.out.println(c + "出现了" + num + "次");
            str = str1;
        }
    }
}
